# coding=utf-8
from typing import List


class Solution:
    def search(self, nums: List[int], target: int) -> int:
        l = 0
        r = len(nums)
        while r > l:
            m = (l + r) // 2
            if nums[m] == target:
                return m
            if nums[m] > target:
                r = m
            if nums[m] < target:
                l = m + 1
        return -1
    


